const express = require('express');
const animalsRouter = require('./routes/animals'); // 假设路由文件在routes文件夹内
const animalDetailsRouter = require('./routes/animalDetails');
const searchRouter = require('./routes/search');

const app = express();
app.use(express.json());

// 挂载查询单个动物路由
app.use('/api/animals/search', searchRouter);

// 挂载动物列表路由
app.use('/api/animals', animalsRouter);

// 挂载单个动物详情路由
app.use('/api/animals', animalDetailsRouter);

const PORT = 3001;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});